<!--
* description: 索赔倒扣审核
* author: wangjuan
* createdDate:2020-11-12
-->
<template>
  <section class="editSetBelowAdd">
    <el-dialog
      v-dialogDrag
      :visible.sync="curPopupsVisible"
      :title="textMap[popupsState]"
      :append-to-body="true"
      width="70%"
      :close-on-click-modal="false"
      @close="closeEdit"
    >
      <dialogHeader
        slot="title"
        :title="textMap[popupsState]"
        :style-type="$store.state.app.dialogType"
      />

      <div class="filter-container filter-title">索赔单信息</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList1" :gutter="26">
          <component
            :is="comp.component"
            v-for="comp in tableComponents1.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :data-to-object="comp.dataToObj"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
      </div>

      <div class="filter-container filter-title">车辆信息</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList2" :gutter="26">
          <component
            :is="comp.component"
            v-for="comp in tableComponents2.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
      </div>

      <div class="filter-container filter-title">客户信息</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList2" :gutter="26">
          <component
            :is="comp.component"
            v-for="comp in tableComponents3.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
      </div>

      <div class="filter-container filter-title">倒扣单信息</div>
      <div class="filter-container filter-params">
        <el-row ref="vailComponentList2" :gutter="26">
          <component
            :is="comp.component"
            v-for="comp in tableComponents4.filter((o) => o.isMust === true)"
            :ref="comp.isRequire ? comp.isRequire + comp.compKey : comp.compKey"
            :key="comp.compKey"
            :validrule="comp.validrule"
            :code-field="comp.codeField"
            :text-field="comp.textField"
            :popups-key="comp.compKey"
            :parent-fileds="comp.parentFileds"
            :code="formField[comp.codeField]"
            :disabled="comp.disabled"
            :o-fields="comp.oFields"
            :options="comp.options"
            :custom-obj="comp.customObj"
            :is-require="comp.isRequire"
            :is-mul="comp.isMul"
            :span="comp.span || 8"
            :label-name="comp.labelName"
            :lookuptype="comp.lookuptype"
            :date-options-type="comp.dateOptionsType"
            @changeCode="getComponentCode"
            @focusCode="getFocusCode"
          />
        </el-row>
      </div>

      <div class="filter-container filter-title">其他信息</div>
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane label="故障信息" name="first">
          <div class="filter-container filter-params">
            <el-row ref="vailComponentList2" :gutter="26">
              <component
                :is="comp.component"
                v-for="comp in tableComponents5.filter((o) => o.isMust === true)"
                :ref="comp.isRequire? comp.isRequire + comp.compKey: comp.compKey"
                :key="comp.compKey"
                :validrule="comp.validrule"
                :code-field="comp.codeField"
                :text-field="comp.textField"
                :popups-key="comp.compKey"
                :parent-fileds="comp.parentFileds"
                :code="formField[comp.codeField]"
                :disabled="comp.disabled"
                :o-fields="comp.oFields"
                :options="comp.options"
                :custom-obj="comp.customObj"
                :is-require="comp.isRequire"
                :is-mul="comp.isMul"
                :span="comp.span || 8"
                :label-name="comp.labelName"
                :lookuptype="comp.lookuptype"
                :date-options-type="comp.dateOptionsType"
                @changeCode="getComponentCode"
                @focusCode="getFocusCode"
              />
            </el-row>
          </div>
        </el-tab-pane>
        <el-tab-pane label="附件信息" name="second">
          <one-table-template
            ref="multipleTable"
            :dynamic-buttons="dynamicTableButtons"
            :dynamic-table-cols="tableCols1"
            :dynamic-api-config="apiConfig"
            :dynamic-form-fields="formField"
            :dynamic-is-init-table="true"
            :dynamic-is-show-select="true"
            :dynamic-is-show-more-btn="true"
            :dynamic-table-defult-height="200"
            :is-show-pagination="false"
          />
        </el-tab-pane>
        <el-tab-pane label="索赔项目" name="third">
          <one-table-template
            ref="multipleTable"
            :dynamic-table-cols="tableCols"
            :dynamic-api-config="apiConfig"
            :dynamic-form-fields="formField"
            :dynamic-is-init-table="true"
            :dynamic-is-show-select="false"
            :dynamic-is-show-more-btn="true"
            :dynamic-table-defult-height="200"
            :is-show-pagination="false"
          />
        </el-tab-pane>
        <el-tab-pane label="索赔备件" name="fourth">
          <one-table-template
            ref="multipleTable"
            :dynamic-table-cols="tableCols2"
            :dynamic-api-config="apiConfig"
            :dynamic-form-fields="formField"
            :dynamic-is-init-table="true"
            :dynamic-is-show-select="false"
            :dynamic-is-show-more-btn="true"
            :dynamic-table-defult-height="200"
            :is-show-pagination="false"
          />
        </el-tab-pane>
        <el-tab-pane label="索赔其他项目" name="fiveth">
          <one-table-template
            ref="multipleTable"
            :dynamic-table-cols="tableCols3"
            :dynamic-api-config="apiConfig"
            :dynamic-form-fields="formField"
            :dynamic-is-init-table="true"
            :dynamic-is-show-select="false"
            :dynamic-is-show-more-btn="true"
            :dynamic-table-defult-height="200"
            :is-show-pagination="false"
          />
        </el-tab-pane>
        <el-tab-pane label="审核信息" name="sixth">
          <one-table-template
            ref="multipleTable"
            :dynamic-table-cols="tableCols4"
            :dynamic-api-config="apiConfig"
            :dynamic-form-fields="formField"
            :dynamic-is-init-table="true"
            :dynamic-is-show-select="false"
            :dynamic-is-show-more-btn="true"
            :dynamic-table-defult-height="200"
            :is-show-pagination="false"
          />
        </el-tab-pane>
      </el-tabs>
    </el-dialog>
  </section>
</template>
<script>
import { oneTableWithViewTemplateMixins } from '@/components/mixins/oneTableWithViewTemplateMixins'
import { formMixins } from '@/components/mixins/formMixins'
import OneTableTemplate from '@/components/templates/oneTable'
import api from '@/api/belowInfo'
import apis from '@/api/subsidyManage'
import { setDynamicFieldsData } from '@/utils/dataOperation'

export default {
  components: {
    dialogHeader: () => import('@/components/dialogHeader'),
    OneTableTemplate
  },
  // 组件混入对象
  mixins: [oneTableWithViewTemplateMixins, formMixins],

  props: {
    dynamicEditRowData: {
      type: Object,
      default: () => {
        return {}
      }
    },
    // 弹出是否显示
    popupsVisible: { type: Boolean, default: false },
    customObj: {
      type: Object,
      default: () => {
        return {}
      }
    }
  },

  data() {
    const viewPageCode = 'belowOrd-Edit'
    return {
      multable: 'multipleTable1',
      showBtn: '1', // 开关
      deleteTransferOrderDId: [],
      updateControlIdD: [],

      dataRefs: ['truecompKey2', 'truecompKey3'],
      apiConfig: api.queryExhibitionCarProductionByDetail,
      // 动态组件-按钮
      dynamicTableButtons: [
        {
          compKey: 'btnKey1',
          type: 'primary',
          size: 'small',
          name: 'preservation',
          clickEvent: () => this.addRow(),
          text: '下载',
          isShow: true
        }
        // {
        //   compKey: "btnKey2",
        //   type: "primary",
        //   size: "small",
        //   name: "preservation",
        //   clickEvent: (index) => this.saveEdit(index),
        //   text: "保存编辑",
        //   isShow: false,
        // },
        // {
        //   compKey: "btnKey3",
        //   type: "primary",
        //   size: "small",
        //   name: "preservation",
        //   clickEvent: () => this.cancelEdit(),
        //   text: "取消编辑",
        //   isShow: false,
        // },
      ],

      dynamicTableButtonsUpload: [
        {
          compKey: 'btnKey1',
          type: 'primary',
          size: 'small',
          name: 'upload',
          clickEvent: () => this.addRow(),
          text: '上传附件',
          isShow: true
        }
      ],

      tableButtons: [
        {
          compKey: 'btnKey1',
          type: 'primary',
          size: 'small',
          name: 'preservation',
          clickEvent: () => this.save(),
          text: this.$t('sys.button.save')
        },
        {
          compKey: 'btnKey2',
          size: 'small',
          naem: 'cancel',
          icon: 'iconfont icon-cancel',
          clickEvent: () => this.closeEdit(1),
          text: this.$t('sys.button.cancel')
        }
      ],
      tableComponents:
        this.$ConfigCache.CacheConfig.cacheData[viewPageCode] &&
        this.$ConfigCache.CacheConfig.cacheData[viewPageCode].formComponents
          .length > 0
          ? this.$ConfigCache.CacheConfig.cacheData[viewPageCode].formComponents
          : [],
      // 动态组件-查询条件
      tableComponents1:
        this.$ConfigCache.CacheConfig.cacheData[viewPageCode] &&
        this.$ConfigCache.CacheConfig.cacheData[viewPageCode].formComponents
          .length > 0
          ? this.$ConfigCache.CacheConfig.cacheData[viewPageCode].formComponents
          : [
            {
              compKey: 'compKey1',
              labelName: '门店编号：',
              codeField: 'transferOrderCode',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              disabled: true,
              isMul: false,
              isMust: true,
              span: 6
            },
            {
              compKey: 'compKey2',
              labelName: '门店名称：',
              codeField: 'chargeMen',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              disabled: true,
              isMul: false,
              isMust: true,
              span: 6
            },
            {
              compKey: 'compKey3',
              labelName: '索赔单号：',
              codeField: 'chargePhone',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              disabled: true,
              isMul: false,
              isMust: true,
              span: 6
            },
            {
              compKey: 'compKey4',
              labelName: '单据状态：',
              codeField: 'chargePhone',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              disabled: true,
              isMul: false,
              isMust: true,
              span: 6
            },
            {
              compKey: 'compKey5',
              labelName: '索赔员：',
              codeField: 'cityId',
              textField: 'cityName',
              oFields: 'cityId,cityName',
              customObj: {
                api: apis.listOfCities,
                selectType: '1'
              },
              component: () => import('@/components/org/commonSelect'),
              type: 'dropdownList',
              isMust: true,
              disabled: true,
              span: 6
            },
            {
              compKey: 'compKey6',
              labelName: '索赔员电话：',
              codeField: 'chargePhone',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              disabled: true,
              isMul: false,
              isMust: true,
              span: 6
            },
            {
              compKey: 'compKey7',
              labelName: '索赔分类：',
              codeField: 'cityId',
              textField: 'cityName',
              oFields: 'cityId,cityName',
              customObj: {
                api: apis.listOfCities,
                selectType: '1'
              },
              component: () => import('@/components/org/commonSelect'),
              type: 'dropdownList',
              isMust: true,
              disabled: true,
              span: 6
            },
            {
              compKey: 'compKey8',
              labelName: '活动编号：',
              codeField: 'cityId',
              textField: 'cityName',
              oFields: 'cityId,cityName',
              customObj: {
                api: apis.listOfCities,
                selectType: '1'
              },
              component: () => import('@/components/org/commonSelect'),
              type: 'dropdownList',
              isMust: true,
              disabled: true,
              span: 6
            },
            {
              compKey: 'compKey9',
              labelName: '索赔月份：',
              codeField: 'chargePhone',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              disabled: true,
              isMul: false,
              isMust: true,
              span: 6
            },
            {
              compKey: 'compKey10',
              labelName: '提交日期：',
              codeField: 'custName',
              component: () =>
                import('@/components/org/datePicker/datePicker.vue'),
              type: 'inputText',
              disabled: true,
              isMul: false,
              isMust: true,
              span: 6
            },
            {
              compKey: 'compKey11',
              labelName: '运输费：',
              codeField: 'chargePhone',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              disabled: true,
              isMul: false,
              isMust: true,
              span: 6
            },
            {
              compKey: 'compKey12',
              labelName: '补偿意外费：',
              codeField: 'chargePhone',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              disabled: true,
              isMul: false,
              isMust: true,
              span: 6
            },
            {
              compKey: 'compKey13',
              labelName: '工时费：',
              codeField: 'chargePhone',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              disabled: true,
              isMul: false,
              isMust: true,
              span: 6
            },
            {
              compKey: 'compKey14',
              labelName: '备件费：',
              codeField: 'chargePhone',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              disabled: true,
              isMul: false,
              isMust: true,
              span: 6
            },
            {
              compKey: 'compKey15',
              labelName: '其他费用：',
              codeField: 'chargePhone',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              disabled: true,
              isMul: false,
              isMust: true,
              span: 6
            },
            {
              compKey: 'compKey16',
              labelName: '总金额：',
              codeField: 'chargePhone',
              component: () => import('@/components/org/commonInput'),
              type: 'inputText',
              disabled: true,
              isMul: false,
              isMust: true,
              span: 6
            }
          ],

      tableComponents2: [
        {
          compKey: 'compKey1',
          labelName: '派单工号：',
          codeField: 'dlrFullName',
          textField: 'dlrFullName',
          component: () => import('@/components/ve/salesStore'),
          type: 'inputText',
          disabled: true,
          isMust: true,
          isMul: false,
          span: 6
        },
        {
          compKey: 'compKey2',
          labelName: '车牌号：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey3',
          labelName: '车型：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey4',
          labelName: '进厂时间：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey5',
          labelName: '保修开始时间：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey6',
          labelName: '行驶里程：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey7',
          labelName: '购件里程：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey8',
          labelName: '购件日期：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey9',
          labelName: '保修申请单号：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey10',
          labelName: 'VIN码：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey11',
          labelName: '车辆用途：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey12',
          labelName: '生产日期：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey13',
          labelName: '前电机号：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey14',
          labelName: '后电机号：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey15',
          labelName: '底盘号：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey16',
          labelName: '变速箱号：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        }
      ],

      tableComponents3: [
        {
          compKey: 'compKey1',
          labelName: '车主姓名：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey2',
          labelName: '性别：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey3',
          labelName: '车主手机：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey4',
          labelName: '省份：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey5',
          labelName: '城市：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey6',
          labelName: '区县：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey7',
          labelName: '街道地址：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 12
        },
        {
          compKey: 'compKey8',
          labelName: '送修人：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey9',
          labelName: '送修人电话：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        }
      ],

      tableComponents4: [
        {
          compKey: 'compKey1',
          labelName: '倒扣单号：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey2',
          labelName: '倒扣状态：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey3',
          labelName: '已扣金额：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey4',
          labelName: '待扣金额：',
          codeField: 'remark02',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey5',
          labelName: '倒扣金额：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isRequire: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey6',
          labelName: '倒扣原因：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isRequire: true,
          isMul: false,
          isMust: true,
          span: 18
        }
      ],

      tableComponents5: [
        {
          compKey: 'compKey',
          labelName: '故障类型：',
          codeField: 'cityId',
          textField: 'cityName',
          oFields: 'cityId,cityName',
          customObj: {
            api: apis.listOfCities,
            selectType: '1'
          },
          component: () => import('@/components/org/commonSelect'),
          type: 'dropdownList',
          isMust: true,
          disabled: true,
          span: 6
        },
        {
          compKey: 'compKey2',
          labelName: '故障件编码：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey3',
          labelName: '故障件名称：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey4',
          labelName: '故障件日期：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey5',
          labelName: '故障现象码：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey6',
          labelName: '故障原因码：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey7',
          labelName: '故障部位：',
          codeField: 'cityId',
          textField: 'cityName',
          oFields: 'cityId,cityName',
          customObj: {
            api: apis.listOfCities,
            selectType: '1'
          },
          component: () => import('@/components/org/commonSelect'),
          type: 'dropdownList',
          isMust: true,
          disabled: true,
          span: 6
        },
        {
          compKey: 'compKey8',
          labelName: '故障数据：',
          codeField: 'chargePhone',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMul: false,
          isMust: true,
          span: 6
        },
        {
          compKey: 'compKey9',
          labelName: '备注：',
          codeField: 'remark02',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMust: true,
          span: 24
        },
        {
          compKey: 'compKey10',
          labelName: '故障描述：',
          codeField: 'remark02',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMust: true,
          span: 24
        },
        {
          compKey: 'compKey11',
          labelName: '诊断过程：',
          codeField: 'remark02',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMust: true,
          span: 24
        },
        {
          compKey: 'compKey12',
          labelName: '故障处理：',
          codeField: 'remark02',
          component: () => import('@/components/org/commonInput'),
          type: 'inputText',
          disabled: true,
          isMust: true,
          span: 24
        }
      ],

      tableCols: [
        {
          prop: 'releaseId',
          label: '主键ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdO',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdOd',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderId',
          label: '展车主单id',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderDId',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'carSeriesCn',
          label: '工时编码',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '维修内容',
          align: 'center'
        },
        {
          prop: 'optionalPagName',
          label: '工时数',
          align: 'center'
        },
        {
          prop: 'carColorName',
          label: '工时单价',
          align: 'center'
        },
        {
          prop: 'carIncolorName',
          label: '费用合计',
          align: 'center'
        },
        {
          prop: 'cityName',
          label: '索赔系数',
          align: 'center'
        },
        {
          prop: 'deliveryDlrFullName',
          label: '是否主工时',
          align: 'center'
        },
        {
          prop: 'dlrFullName',
          label: '备注',
          align: 'center'
        }
      ],

      tableCols1: [
        {
          prop: 'releaseId',
          label: '主键ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdO',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdOd',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderId',
          label: '展车主单id',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderDId',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'carSeriesCn',
          label: '附件名称',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '备注',
          align: 'center'
        }
      ],

      tableCols2: [
        {
          prop: 'releaseId',
          label: '主键ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdO',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdOd',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderId',
          label: '展车主单id',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderDId',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'carSeriesCn',
          label: '备件编码',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '备件名称',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '数量',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '单价',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '费用合计',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '索赔系数',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '是否主备件',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '备件',
          align: 'center'
        }
      ],

      tableCols3: [
        {
          prop: 'releaseId',
          label: '主键ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdO',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdOd',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderId',
          label: '展车主单id',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderDId',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'carSeriesCn',
          label: '其他项目',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '费用',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '备件',
          align: 'center'
        }
      ],

      tableCols4: [
        {
          prop: 'releaseId',
          label: '主键ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdO',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'updateControlIdOd',
          label: '并发控制ID',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderId',
          label: '展车主单id',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'transferOrderDId',
          hidden: true,
          alwaysHidden: true
        },
        {
          prop: 'carSeriesCn',
          label: '审核结果',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '审核意见',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '审核人',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '审核时间',
          align: 'center'
        },
        {
          prop: 'carConfigCn',
          label: '备注',
          align: 'center'
        }
      ],

      formField: {
        carSeriesId: '',
        carConfigId: '',
        optionalPagId: '',
        carColorId: '',
        carIncolorId: '',
        cityId: '',
        deliveryDlrId: '',
        dlrId: '',
        orderNum: '',
        carSeriesCn: '',
        carConfigCn: '',
        optionalPagName: '',
        carColorName: '',
        carIncolorName: '',
        cityName: '',
        deliveryDlrFullName: '',
        dlrFullName: '',
        remark02: '',
        updateControlIdO: '',
        updateControlIdOd: '',
        transferOrderDId: '',
        chargeMen: '',
        chargePhone: '',
        remark: '',
        transferOrderCode: '',
        transferOrderId: ''
      },
      // 标题
      textMap: {
        edit: '查看索赔倒扣详情',
        add: '新增索赔申诉',
        view: '索赔申诉详情'
      },
      activeName: 'first', // tab栏默认项
      dataList: [],
      cIndex: 0
    }
  },
  watch: {
    'formField.cityId': {
      handler: function(val) {
        // debugger
        if (val) {
          this.$requestAPI({
            apiUrl: api.ListOfDeliveryStoreContent.APIUrl,
            variables: { cityId: val }
          }).then((response) => {
            if (response.result === '1') {
              const rowData = response.rows[0]
              this.formField.deliveryDlrId = rowData.deliveryDlrId
              this.formField.deliveryDlrFullName = rowData.deliveryDlrFullName
            }
          })
        }
      }
    },
    curPopupsVisible(val) {
      // debugger
      if (val) {
        if (this.popupsState === 'edit') {
          const queryObj = {
            type: 'mutation',
            apiConfig: api.queryExhibitionCarProductionByDetail,
            variables: { transferOrderId: this.formField.transferOrderId }
          }
          var paramD = this.$getParams(queryObj)
          this.$requestAPI(paramD).then((response) => {
            if (response.result === '1') {
              const list = response.rows
              this.$refs.multipleTable.list = list
              this.dataList = list
            }
          })
        }
      }
    }
  },

  created() {
    this.tableComponents = [
      ...this.tableComponents1,
      ...this.tableComponents2,
      ...this.tableComponents3,
      ...this.tableComponents4,
      ...this.tableComponents5
    ]
  },

  mounted() {
    this.$nextTick(() => {
      this.formField = Object.assign(this.formField, this.dynamicEditRowData)
      if (this.popupsState === 'edit') {
        this.$refs.multipleTable.queryTable(1)
      }
    })
  },

  methods: {
    // 清除验证
    resetOrderIcon() {
      this.$nextTick(() => {
        for (const comp in this.$refs) {
          if (comp.includes('true')) {
            this.$refs[comp][0].$children[0].$children[2].iconV = '3'
          }
        }
      })
    },

    handleClick(tab, event) {
      console.log(tab, event)
    },

    // 添加
    addRow() {
      // debugger
      this.$utils.validataMoth(
        this,
        'validpopup',
        undefined,
        'multipleTable',
        undefined,
        function(refs) {
          const vpage = {}
          for (const ref in refs) {
            !this.dataRefs.includes(ref) ? (vpage[ref] = refs[ref]) : ''
          }
          return vpage
        }
      )
      if (this.valid) {
        this.$refs.multipleTable.list.push(
          this.$utils.deepCopy(this.formField)
        )
        this.$message({
          message: '添加成功',
          duration: 1000
        })
      }
    },

    // 保存编辑
    saveEdit(index) {
      // debugger
      var dataList = this.$utils.deepCopy(this.$refs.multipleTable.list)
      for (let i = 0; i < dataList.length; i++) {
        if (this.cIndex === dataList[i].transferOrderDId) {
          var datas = this.$utils.deepCopy(this.formField)
          dataList[i] = datas
        }
      }
      this.$refs.multipleTable.list = this.$utils.deepCopy(dataList)
      this.$message({
        message: '编辑成功',
        duration: 1000
      })
      // 显示隐藏按钮
      this.showBtn = '1'
      this.dynamicTableButtons.forEach((v, i) => {
        if (v.isShow) {
          v.isShow = false
        } else {
          v.isShow = true
        }
      })
      this.resetOrderIcon()
      this.resetData()
    },

    // 取消编辑
    cancelEdit() {
      // debugger
      this.showBtn = '1'
      this.dynamicTableButtons.forEach((v, i) => {
        if (v.isShow) {
          v.isShow = false
        } else {
          v.isShow = true
        }
      })
      this.resetOrderIcon()
      this.resetData()
    },
    // 清空
    resetData() {
      this.$utils.deepClone(this.formField)
      this.formField.carSeriesId = ''
      this.formField.carSeriesCn = ''
      this.formField.carConfigId = ''
      this.formField.carConfigCn = ''
      this.formField.optionalPagId = ''
      this.formField.optionalPagName = ''
      this.formField.carColorId = ''
      this.formField.carColorName = ''
      this.formField.carIncolorId = ''
      this.formField.carIncolorName = ''
      this.formField.cityId = ''
      this.formField.cityName = ''
      this.formField.deliveryDlrId = ''
      this.formField.deliveryDlrFullName = ''
      this.formField.dlrFullName = ''
      this.formField.dlrId = ''
      this.formField.orderNum = ''
      this.formField.remark02 = ''
    },

    // 子单-编辑
    handleEdit(index) {
      this.cIndex = this.$refs.multipleTable.list[index].transferOrderDId
      // debugger
      if (this.showBtn === '1') {
        this.dynamicTableButtons.forEach((v, i) => {
          if (v.isShow) {
            v.isShow = false
          } else {
            v.isShow = true
          }
        })
      }
      this.showBtn = 0
      // 回填数据-onetable
      setDynamicFieldsData(
        this.formField,
        this.$refs.multipleTable.list[index]
      )
    },

    // 子单-删除
    handleDelete(index) {
      this.deleteTransferOrderDId.push(
        this.$refs.multipleTable.list[index].transferOrderDId
      )
      this.updateControlIdD.push(
        this.$refs.multipleTable.list[index].updateControlIdOd
      )
      this.$confirm('是否继续删除改数据', '提示', {
        type: 'warning'
      }).then(() => {
        const delDatas = this.$refs.multipleTable.list
        delDatas.splice(index, 1)
        this.$message({
          message: '删除成功',
          duration: 1000
        })
      })
    },

    // 新增/编辑保存按钮
    save() {
      const that = this
      this.$utils.validataMoth(
        this,
        'validpopup',
        undefined,
        'multipleTable',
        undefined,
        function(refs) {
          const vpage = {}
          for (const ref in refs) {
            this.dataRefs.includes(ref) ? (vpage[ref] = refs[ref]) : ''
          }
          return vpage
        }
      )
      if (that.valid) {
        that.editSave()
        that.addSave()
      }
    },

    // 编辑保存
    editSave() {
      const that = this
      const queryObj = {
        type: 'mutation',
        apiConfig: api.updateExhibitionCarProduction,
        variables: {
          data: that.$refs.multipleTable.list,
          chargeMen: that.formField.chargeMen,
          chargePhone: that.formField.chargePhone,
          remark: that.formField.remark,
          transferOrderId: that.formField.transferOrderId,
          updateControlIdO: that.formField.updateControlIdO,
          updateControlIdOd: that.formField.updateControlIdOd,
          transferOrderDId: that.formField.transferOrderDId,
          deleteTransferOrderDId: this.deleteTransferOrderDId,
          updateControlIdD: this.updateControlIdD
        }
      }
      var paramD = this.$getParams(queryObj)
      this.$requestAPI(paramD).then((response) => {
        if (response.result === '1') {
          this.$message({
            message: response.msg,
            duration: 1000
          })
          this.$emit('update:popupsVisible', false)
          this.$parent.$refs.multipleTable.queryTable(1)
        } else {
          this.$message({
            message: response.msg,
            duration: 1000
          })
        }
        this.$emit('update:popupsVisible', false)
      })
    },

    // 新增保存
    addSave() {
      const that = this
      const queryObj = {
        type: 'mutation',
        apiConfig: api.insertExhibitionCarProduction,
        variables: {
          data: that.$refs.multipleTable.list,
          chargeMen: that.formField.chargeMen,
          chargePhone: that.formField.chargePhone,
          remark: that.formField.remark
        }
      }
      var paramD = this.$getParams(queryObj)
      this.$requestAPI(paramD).then((response) => {
        if (response.result === '1') {
          this.$message({
            message: response.msg,
            duration: 1000
          })
          this.$emit('update:popupsVisible', false)
          this.$parent.$refs.multipleTable.queryTable(1)
        } else {
          this.$message({
            message: response.msg,
            duration: 1000
          })
        }
        this.$emit('update:popupsVisible', false)
      })
    },
    // 关闭弹窗
    // handleClose(done) {
    //   this.$confirm('还未保存，是否确认关闭窗口？', '提示', {
    //     type: 'warning'
    //   })
    //     .then(_ => {
    //       this.$emit('update:popupsVisible', false)
    //       done()
    //     })
    //     .catch(_ => {})
    // },

    closeEdit() {
      this.clearData()
      this.resetOrderIcon()
      this.$emit('update:popupsVisible', false)
    }
  }
}
</script>

<style lang="scss" scoped>
.filter-title {
  font-size: 18px;
  font-weight: bolder;
}
.filter-container.filter-title::before {
  border-left: 4px solid #0075ff;
  padding-right: 10px;
  height: 20px;
  left: 0px;
  top: 4px;
}

.btns-container {
		width: 100%;
		height: 30px;
		padding: 0 20px;
		background-color: #fff;
		.el-button {
			float: right;
		}
	}
</style>
